Let's change the direction of the ball when it collides with the paddle.

  • Delete the .say() command under the first if statement.
  • Use Random Choice to change the direction and speed of the ball. Name it y_speed.
  • Replace the parameter with a list of positive numbers like [2, 3, 4].
  • Use Set y Speed to change the speed of the ball to y_speed.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)